#ifndef CARDLINKEDLIST_H_
#define CARDLINKEDLIST_H_
#include "ListException.h"
#include "ListIndexOutOfRangeException.h"
#include "card.h"

typedef Card ListItemType;

//ADT - Pointer based Linked List for cards in a flashcard deck
class CardLinkedList {

public:

//Constructors and Destructors

    //Default Constructor
    CardLinkedList();
    
    //Copy Constructor
    CardLinkedList(const CardLinkedList& aList);
    
    //Destructor
    ~CardLinkedList();
    
    //List Operations
    bool isEmpty() const;
    int getLength() const;
    void insert(int index, const ListItemType& dataItem) throw (ListIndexOutOfRangeException,ListException);
    void remove(int index) throw (ListIndexOutOfRangeException);
    void retrieve(int index, ListItemType& dataItem) const throw (ListIndexOutOfRangeException);

private:

    struct CardLinkedListNode {
        ListItemType       item;
        CardLinkedListNode *next;
    };
    
    int                 size;
    CardLinkedListNode *head;
    
    CardLinkedListNode *find(int index) const;
    
};
#endif
